import {
    wxfileTobase64
} from '../../../utils/util.js'
import {
    insuranceRecharge,
    addLongTermRecharge,
    getTyxChargeAccount
} from '../../api/insurance.js'
import { getInsuranceProgramme, addRechargeRecord } from '../../../api/app'
import user from '../../../utils/user.js'
const app = getApp()
let base64 = ''
Page({

    /**
     * 页面的初始数据
     */
    data: {
        preview: '',
        money: '',
        bankTitle:'',
        bankNum:'',
        bankName:'',
        insureCompanyType:'',
        rechargeType: '',
        yearList: ['1年','2年','3年'],
        yearIndex: '0',
        productType: '',
        bankLogo:''
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad (options) {
        this.getTyxChargeAccount()
    },
    onUnload(){
        console.log('卸载啦')
        base64=''
    },
    copy(event) {
        wx.setClipboardData({
            data: event.currentTarget.dataset.copy, // 这个是要复制的数据
        })
    },
    async getTyxChargeAccount(){
        const result = await getTyxChargeAccount()
        console.log(result, 'result')
        this.setData({
            bankTitle: '中国工商银行深圳市东门支行',
            bankNum: result,
            bankName: '微民保险代理有限公司',
            bankLogo: '/packageMicroInsurance/assets/img/safety-bank.png',
        })
    }
})